package com.acwing.partition11;

import java.io.*;

/**
 * @author `RKC`
 * @date 2022/3/6 9:16
 */
public class AC1050鸣人的影分身 {

    private static final int N = 15;
    private static int[][] f = new int[N][N];
    private static int n, m;

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        int t = Integer.parseInt(reader.readLine());
        while (t-- > 0) {
            String[] ss = reader.readLine().split(" ");
            m = Integer.parseInt(ss[0]);
            n = Integer.parseInt(ss[1]);
            f[0][0] = 1;
            for (int i = 0; i <= m; i++) {
                for (int j = 1; j <= n; j++) {
                    f[i][j] = f[i][j - 1];
                    if (i >= j) f[i][j] += f[i - j][j];
                }
            }
            writer.write(f[m][n] + "\n");
        }
        writer.flush();
    }
}
